<template>
  <div>
    
    <!-- 表格 -->
    <el-table size="small" :data="comment">
     <el-table-column prop="id" label="编号" width="80" />
      <el-table-column prop="commenTime" label="发表/评论时间" />
      <el-table-column prop="orderId" label="订单ID" />
      <el-table-column prop="userId" label="顾客ID" />
      <el-table-column prop="parentId" label="是否为追评" />
      <el-table-column prop="score" label="服务打分" />
      <el-table-column prop="content" label="评论" />
      <el-table-column prop="status" label="状态" />
      <el-table-column fixed="right" label="操作">
        <template slot-scope="scope">
          <el-button type="danger" size="mini" @click="del(scope.row.id)">删除</el-button>
          <!-- <el-button type="primary" size="mini" @click="edit(scope.row)">修改</el-button> -->
        </template>
      </el-table-column>
    </el-table>
    <!-- 表格结束 -->
   
  </div>
</template>
<script>
import { get, post } from "@/utils/request";   //导入方法
export default {
  data() {
    return {
       // text: '',
      visable: false,
      form: {},
      comment: [],
      rules: {
        
      }
    };
  },
  created() {
    this.loadComment();
  },
  methods: {
    loadComment() {
      let url = "http://47.95.112.55:8888/comment/findAllComments";
      get(url).then(response => {
        this.comment = response.data;
      });
    },
    //删除操作
    del(id) {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        // 删除
        let url = "http://47.95.112.55:8888/comment/findByIdWithFollow";
        get(url, { id: id }).then(response => {
          // 提示
          this.$message({ type: "success", message: response.message });
          // 刷新数据
          this.loadComment();
        });
      });
    },

    
    edit(row) {
      this.form = row;
      this.visable = true;
    }
  }
};
</script>

<style>
</style>